/*
    日志模块
*/

#pragma once
#include <iostream>
#include "util.hpp"

using namespace ns_util;

// 日志等级
enum
{
    INFO,
    DUBUG,
    WARNING,
    ERROR,
    FATAL
};

#define LOG(level) logMessage(level, __FILE__, __func__)

std::ostream &logMessage(int level, std::string filename, std::string funcname)
{
    //开放式日志，将必要信息预先加载到缓冲区，添加完可变信息后再控制刷新
    std::cout << "[" << TimeUtil::getTimeStr(1) << "]" /*当前时间*/
              << "[" << level << "]" /*等级*/
              << "[" << filename << "]" /*文件名*/
              << "[" << "function:" << funcname << "]"; /*函数名*/
    return std::cout;
}